<?php

declare(strict_types=1);

use app\model\Admin;
use Phinx\Seed\AbstractSeed;

class CreateTestAdminsData extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run(): void
    {
        $data = [
            [
                'username' => 'admin',
                'email' => 'admin@example.com',
                'password' => Admin::generateDefaultPassword(),
                'nickname' => '管理员',
            ],
        ];
        $this->table(new Admin()->getTable())->insert($data)->save();
    }
}
